<include file="public/header" title="预售活动" />
<include file="public/header_nav" title="预售活动" href="javascript:history.back(-1)"/>
<!--倒计时-->
<script>
    var Tday = new Array();
    var daysms = 24 * 60 * 60 * 1000
    var hoursms = 60 * 60 * 1000
    var Secondms = 60 * 1000
    var microsecond = 1000
    var DifferHour = -1
    var DifferMinute = -1
    var DifferSecond = -1
    function clock11(key){
        var time = new Date()
        var hour = time.getHours()
        var minute = time.getMinutes()
        var second = time.getSeconds()
        var timevalue = ""+((hour > 12) ? hour-12:hour)
        timevalue +=((minute < 10) ? ":0":":")+minute
        timevalue +=((second < 10) ? ":0":":")+second
        timevalue +=((hour >12 ) ? " PM":" AM")
        var convertHour = DifferHour
        var convertMinute = DifferMinute
        var convertSecond = DifferSecond
        var Diffms = Tday[key].getTime() - time.getTime()
        if(Diffms > 0){
            DifferHour = Math.floor(Diffms / daysms)
            Diffms -= DifferHour * daysms
            DifferMinute = Math.floor(Diffms / hoursms)
            Diffms -= DifferMinute * hoursms
            DifferSecond = Math.floor(Diffms / Secondms)
            Diffms -= DifferSecond * Secondms
            var dSecs = Math.floor(Diffms / microsecond)

            if(convertHour != DifferHour) e="<span class=hour>"+DifferHour+"</span>天";
            if(convertMinute != DifferMinute) f="<span class=min>"+DifferMinute+"</span>时";
            if(convertSecond != DifferSecond) g="<span class=sec>"+DifferSecond+"</span>分";
            h="<span class=msec>"+dSecs+"</span>秒";
            if (DifferHour>0) {e=e}
            else {e=''}
            document.getElementById("jstimerBox"+key).innerHTML = '剩余<br />'+e + f + g + h;
        }else{
            document.getElementById("jstimerBox"+key).innerHTML = '活动已结束<br />';
        }

    }
</script>
<!--底部商品列表-s-->
<div class="floor guesslike groupquess dic">
    <div class="likeshop">
        <ul>
            <volist name="pre_sell_list" id="vo">
                <li>
                    <a href="{:U('Mobile/Goods/goodsInfo',array('id'=>$vo['goods_id'],'item_id'=>$vo['item_id']))}">
                        <div class="similer-product">
                            <div class="zjj close">
                                <img src="{$vo.goods_id|goods_thum_images=200,200}">
                            </div>
                            <span class="similar-product-text">{$vo[goods_name]}</span>
                            <span class="cy"><i>已购{$vo.deposit_goods_num}</i>件</span>
								<span class="similar-product-price">
									¥<span class="big-price">{$vo[ing_price]}元</span>
									<span class="fr sg_g_time last_g_time" id="jstimerBox{$vo[goods_id]}"></span>
								</span>
                        </div>
                    </a>
                </li>
                <script>
                    Tday['{$vo[goods_id]}'] = new Date('{$vo.sell_end_time|date="Y/m/d H:i:s",###}');
                    window.setInterval(function() {clock11('{$vo[goods_id]}');}, 1000);
                </script>
            </volist>
        </ul>
    </div>
</div>
<div id="getmore" style="font-size:.32rem;text-align: center;color:#888;padding:.25rem .24rem .4rem; clear:both;display: none">
    <a>已显示完所有记录</a>
</div>
<!--底部商品列表-e-->

<!--底部导航-start-->
<include file="public/footer_nav"/>
<script src="__STATIC__/js/style.js" type="text/javascript" charset="utf-8"></script>
<!--底部导航-end-->
<script type="text/javascript">
    //倒计时
    function goTop(){
        $('html,body').animate({'scrollTop':0},600);
    }

    //加载更多商品
    var page = 1;
    var pageEnd = 0;
    function ajax_sourch_submit(){
        ++page;
        $.ajax({
            type:'GET',
            url:"/index.php?m=Mobile&c=Activity&a=pre_sell_list&p="+page,
            success:function(data){
                if(data){
                    $(".likeshop>ul").append(data);
                }else{
                    $('#getmore').remove();
                }
            }
        })
    }
    //滚动加载更多
    $(window).scroll(
            function() {
                var scrollTop =parseInt($(this).scrollTop());
                var scrollHeight = parseInt($(document).height());
                var windowHeight = parseInt($(this).height());
                if (scrollTop + windowHeight >= scrollHeight-50) {
                    if(pageEnd == 0){
                        ajax_sourch_submit();
                    }
                    pageEnd = 1;
                }
            }
    );
</script>
</body>
</html>
